package create;

import model.ImportModel;
import model.ServiceModel;
import util.AllUtil;

import javax.annotation.Resource;

/**
 * Created by eleven on 16/1/7.
 */
public class CreateService {

    @Resource(name = "allUtil")
    private AllUtil allUtil ;

    public Boolean WriteService(String chinesename, String path, String daoname){
        ImportModel importModel = new ImportModel();
        ServiceModel serviceModel = new ServiceModel();
        String stext = serviceModel.Service(chinesename, daoname);
        String simport = importModel.ServiceImport(daoname);
        Boolean result = allUtil.writeInSameFile(path,stext)||allUtil.writeInFileWhichLine(6, path, simport);
        return result;
    }

    public Boolean WriteServiceImpl(String chinesename, String path, String daoname){
        ImportModel importModel = new ImportModel();
        ServiceModel serviceModel = new ServiceModel();
        String simpltext = serviceModel.ServiceImpl(chinesename, daoname);
        String simplimport = importModel.ServiceImplImport(daoname);
        Boolean result = allUtil.writeInSameFile(path,simpltext)||allUtil.writeInFileWhichLine(6, path, simplimport);
        return result;
    }
}
